import { http } from "@/utils/http";
import { sysApi } from "@/config/env";

type Result = {
  success: boolean;
  data?: Array<any>;
};

// export const useMenuNavApi = () => {
// 	return service.get(`${sysApi}/sys/menu/nav`)
// }

// export const useAuthorityListApi = () => {
// 	return service.get(`${sysApi}/sys/menu/authority`)
// }

export const getMenuList = (type?: Number) => {
  // 菜单类型 0：菜单  1：按钮  2：接口
  let url = sysApi + "/sys/menu/list";
  if (type) {
    const menuType = type === 2 ? 2 : 0;
    url = url + "?type=" + menuType;
  }
  return http.request<Result>("get", url);
};

// export const useMenuApi = (id: Number) => {
// 	return service.get(`${sysApi}/sys/menu/` + id)
// }

// export const useMenuSubmitApi = (dataForm: any) => {
// 	if (dataForm.id) {
// 		return service.put(`${sysApi}/sys/menu`, dataForm)
// 	} else {
// 		return service.post(`${sysApi}/sys/menu`, dataForm)
// 	}
// }
